<?php

declare (strict_types=1);

namespace App\Model;

/**
 * Class AftersaleSetService
 * @package App\Model
 */
class AftersaleSet extends Model
{
    public $timestamps = false;
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'fly_after_sell_set';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'string', 'create_by' => 'string', 'update_by' => 'string', 'delete_by' => 'string', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'after_sell_type' => 'string', 'days' => 'string'];

    public function link_industry()
    {
        $fields = ['fly_link_industry.*','fi.industry_name'];
        return $this->hasMany(LinkIndustry::class,'link_id','id')
            ->leftJoin('fly_industry as fi','fi.id','=','fly_link_industry.industry_id')
            ->where('fly_link_industry.type',5)
            ->select($fields);
    }

}